const querystring = require('querystring')

// const queryStr = "id=2&name=shuaiyidong&from=太原"
// const queryObj = {
//   id: 2,
//   name: 'shuaiyidong',
//   from: '山西'
// }

// console.log(querystring.parse(queryStr))
// console.log(querystring.stringify(queryObj))

var domain = 'http://www.baidu.com?'
var str = 'id=3&city=北京&url=https://www.baidu.com'
var escaped = querystring.escape(str)
console.log(domain + escaped)